Component org.nuxeo.ecm.core.versioning.VersioningService
In bundle org.nuxeo.ecm.core
Documentation
The versioning service hold the versioning policy used to define what happens to a document's version when it is created, saved, checked in, checked out or restored, and what version increment options (none, minor, major) are made available to the user.
@Since 5.4
Implementation
Class:
org.nuxeo.ecm.core.versioning.VersioningComponent
Services
Extension Points
XML Source
<?xml version="1.0"?>
<component name="org.nuxeo.ecm.core.versioning.VersioningService">
<service>
<provide interface="org.nuxeo.ecm.core.versioning.VersioningService" />
</service>
<implementation class="org.nuxeo.ecm.core.versioning.VersioningComponent" />
<documentation>
The versioning service hold the versioning policy used to define what
happens to a document's version when it is created, saved, checked in,
checked out or restored, and what version increment options (none, minor,
major) are made available to the user.
@Since 5.4
</documentation>
<extension-point name="versioningService">
<documentation>
Extension point defining the implementation of the versioning policy.
Example:
<code>
<service class="some-class" />
</code>
The provided class must implement
org.nuxeo.ecm.core.versioning.VersioningService
The default implementation is
org.nuxeo.ecm.core.versioning.StandardVersioningService You can contribute
org.nuxeo.ecm.core.versioning.CompatVersioningService to get pre-Nuxeo 5.4
behavior.
</documentation>
<object class="org.nuxeo.ecm.core.versioning.VersioningServiceDescriptor" />
</extension-point>
<extension-point name="versioningRules">
<documentation>
CAUTION: Deprecated since 9.1, use policies, filters and restrictions extension points. Compatibility is provided,
contribution to this endpoint will be converted to new contributions in order to preserve the initial state and
options. The default contribution will be converted to a policy with an order equals to 10000, and each
versioningRule will have an order equals to 10000 - idx where idx is the index of rule in VersioningComponent.
Extension point defining default versioning rules or versioning rules by
document type. Contributions to this XP are available for
VersioningService implementing ExtendableVersioningService interface.
Example:
<code>
<defaultVersioningRule>
<initialState major="1" minor="0" />
<options lifeCycleState="*">
<none default="true" />
<minor />
<major />
</options>
<options lifeCycleState="approved">
<none default="true" />
<minor />
</options>
</defaultVersioningRule>
<versioningRule typeName="File" enabled="true">
<initialState major="1" minor="1" />
<options lifeCycleState="project">
<none />
<minor default="true" />
</options>
<options lifeCycleState="approved" />
</versioningRule>
</code>
The defaultVersioningRule will be used for all the document types if no
specific versioningRule is contributed.
typeName attribute is only available for versioningRule tag and should be
the name of a document type.
Initial state is the initial version number of the document. Default is
0.0 .
Options tag contains the different increment option available when saving
a document. Only none, minor and major tags are used. If the default
attribute isn't set, the first tag will be used as default. Options tag
should always have the lifeCycleState attribute. The life cycle state name
"*" can be used to match any state: it'll be used by default if no other
option with a matching state exists.
Following option gives no increment saving option when the current
lifeCycle of the document is approved.
<code>
<options lifeCycleState="approved" />
</code>
Following options removes major increment option and set the minor
increment option as default choice.
<code>
<options lifeCycleState="project">
<none />
<minor default="true" />
</options>
</code>
If no option is specified, the defaultVersioningRule is used. If there is
no defaultVersioningRule, we fall back on the service implementation.
@Since 5.4.2
</documentation>
<object class="org.nuxeo.ecm.core.versioning.VersioningRuleDescriptor" />
<object
class="org.nuxeo.ecm.core.versioning.DefaultVersioningRuleDescriptor" />
</extension-point>
<extension-point name="policies">
<documentation>
Extension point defining versioning policies for documents.
Contributions to this extension point are available for VersioningService
implementing ExtendableVersioningService interface.
Example:
<code>
<policy id="no-versioning-for-system-before-update" beforeUpdate="true" increment="NONE" order="1">
<filter-id>system-document</filter-id>
</policy>
<policy id="no-versioning-for-system-after-update" increment="NONE" order="1">
<filter-id>system-document</filter-id>
</policy>
<policy id="versioning-with-initial-version" increment="MINOR" order="2">
<initialState major="1" minor="0" />
</policy>
</code>
The beforeUpdate attribute enables, if set to true,
to apply versioning before the actual update of the document.
The default value for this attribute is false.
The increment attribute defines which version number
(minor or major) have to be incremented.
The available options for this attribute are :
- NONE
- MINOR
- MAJOR
The order attribute defines in which order the policies
should be taken into account. They are taken in ascending order.
Initial state is the initial version number of the document.
Default is 0.0.
Each policy contains one or multiple filters
defining under which conditions the document should be versioned
(Note that filters for a policy are OR-ed).
@since 9.1
</documentation>
<object class="org.nuxeo.ecm.core.versioning.VersioningPolicyDescriptor" />
</extension-point>
<extension-point name="filters">
<documentation>
Extension point defining filters which can be used
by one or multiple versioning policies.
Contributions to this extension point are available for VersioningService
implementing ExtendableVersioningService interface.
Example :
<code>
<filter id="class-filter" class="foo.bar.CustomVersioningFilter"/>
<filter id="collaborative-filter-on-files">
<type>File</type>
<condition>#{previousDocument.dc.lastContributor != currentDocument.dc.lastContributor}</condition>
</filter>
<filter id="empty">
<type></type>
<facet></facet>
<schema></schema>
<condition></condition>
</filter>
</code>
A custom filter can be defined with the class attribute
if a java class should be used for the filter.
Otherwise, a StandardVersioningFilter will be used
with the following elements available:
- The type element defines which document type will be versioned.
- The facet/schema element defines that the document
will be versioned if it contains the facet/schema.
- The condition element enables creating
a custom condition with an EL expression.
Note that elements for a filter are AND-ed.
@since 9.1
</documentation>
<object class="org.nuxeo.ecm.core.versioning.VersioningFilterDescriptor" />
</extension-point>
<extension-point name="restrictions">
<documentation>
Extension point defining restrictions of versioning option by document type. Contributions to this XP are
available for VersioningService implementing ExtendableVersioningService interface.
Example:
<code>
<restriction type="File">
<options lifeCycleState="project">
<option>NONE</option>
<option default="true">MINOR</option>
</options>
<options lifeCycleState="approved" />
</restriction>
<restriction type="*">
<options lifeCycleState="*">
<option default="true">NONE</option>
<option>MINOR</option>
<option>MAJOR</option>
</options>
<options lifeCycleState="approved">
<option default="true">NONE</option>
<option>MINOR</option>
</options>
</restriction>
</code>
"type" attribute is available for restriction tag and should be the name of a document type.
The restriction with type "*" will be used for all the document types if no specific restriction is contributed.
Options tag contains the different increment option available when saving a document. If the default attribute
isn't set, the first tag will be used as default. Options tag should always have the lifeCycleState attribute.
The life cycle state name "*" can be used to match any state: it'll be used by default if no other option with
a matching state exists.
Following option gives no increment saving option when the current life cycle of the document is approved.
<code>
<options lifeCycleState="approved" />
</code>
Following options removes major increment option and set the minor increment option as default choice when the
current life cycle of the document is projet.
<code>
<options lifeCycleState="project">
<none />
<minor default="true" />
</options>
</code>
If no restriction is specified, the restriction with "*" is used. If there is no default restriction, we fall
back on the service implementation (ie: none, minor and major options are available).
@since 9.1
</documentation>
<object class="org.nuxeo.ecm.core.versioning.VersioningRestrictionDescriptor" />
</extension-point>
</component>